<!DOCTYPE html>
<html>

<head>
    <#include "/dk/admin/components/meta.html" />
    <title>蓝天运动 ${metaTitleSuffix!}</title>
    <#include "/dk/admin/components/stylesheets.html" />
    <style>
        .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
</head>

<body>
    <div id='app'>
        <el-container>
            <#assign menuIndex="1-1" />
            <#include "/dk/admin/components/menu.html" />
            <el-container>
                <#include "/dk/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-form ref="form" :model="info" label-width="80px">
                            <el-row :gutter="20">
                                <el-form-item label="日期">
                                    <el-date-picker v-model="info.date" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="时间">
                                    <template>
                                        <el-time-select placeholder="起始时间" v-model="info.startTime" :picker-options="{ start: '09:00', step: '00:05', end: '21:00' }">
                                        </el-time-select>
                                        <!-- <el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{ start: '06:00', step: '00:05', end: '23:30', minTime: startTime }">
                                    </el-time-select> -->
                                    </template>
                                </el-form-item>
                                <el-form-item label="课程时长">
                                    <el-select v-model="info.courseTime" placeholder="请选择">
                                        <el-option :label="item+'分钟'" :value="item" :key="item" v-for='item in times'></el-option>
                                    </el-select>
                                </el-form-item>
                                <el-col :span="24">
                                    <el-form-item label="课程名称">
                                        <el-input v-model="info.courseName" placeholder="课程名称"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label="主题">
                                        <el-input v-model="info.topic" type='text' placeholder="主题"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label="老师">
                                        <el-input v-model="info.teacherName" type='text' placeholder="老师"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label="教室">
                                        <el-input v-model="info.classroom" type='text' placeholder="教室"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label="最大人数">
                                        <el-input v-model="info.limit" type='number' placeholder="最大人数(不填或0为不限制)"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col>
                                    <el-form-item>
                                        <el-button type="primary" @click="onSubmit">保存</el-button>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/dk/admin/components/footer.html" />
    </div>
    <script src="https://cdn.bootcss.com/vue/2.5.17/vue.min.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://cdn.bootcss.com/qs/6.5.2/qs.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
    <link href="https://cdn.bootcss.com/layer/2.3/skin/layer.css" rel="stylesheet">
    <script src="/components/utils.js"></script>
    <script src="/components/pageJs.js"></script>
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                times: [60, 90, 120],
                imgDatas: [],
                fileList2: [],
                dialogImageUrl: '',
                dialogVisible: false,
                images: [],
                imageUrl: null,
                info: toJson(`${info!{}}`)
            }
        },
        mounted: function() {
            // if (this.info.limit == null) {
            //     this.info.limit = 10
            // }
            // if (this.info.limit == null) {
            //     this.info.limit = 10
            // }
        },
        methods: {
            onSubmit() {
                var imgs = '';
                if (this.info.courseName == null || this.info.courseName == '') {
                    msg('请输入课程名称')
                    return
                }
                var param = {
                    arrangeId: this.info.id,
                    courseName: this.info.courseName,
                    teacherName: this.info.teacherName,
                    startTime: this.info.startTime,
                    date: this.info.date,
                    topic: this.info.topic,
                    limit: this.info.limit,
                    classroom: this.info.classroom,
                }
                var url = ''
                var ref = '${referer!""}'
                var url = '/dk/admin/submit'
                axiosRequest(param, url, ref)
            },
            fileChanged(file, fileList) {
                this.imgDatas = fileList
            },
            ck() {
                console.log(this.imgDatas)
            },
            req(file) {
                onUploadSMImage(file)
            },
            handleAvatarSuccess(res, file) {
                console.log(res)
                console.log(file)
                this.form.cover = res.data.url
                // this.form.cover = URL.createObjectURL(file.raw);
            },
        },
        filters: {
            fmt(date) {
                return date
            }
        }
    })
    </script>
    <script>
    // vue.tableData = ${items!};
    </script>
</body>

</html>